<?php
/**
 * @version		$Id: message.php 9764 2007-12-30 07:48:11Z ircmaxell $
 * @package		Joomla.Framework
 * @subpackage	Document
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */



/**
 * JDocument system message renderer
 *
 * @author		Louis Landry <louis.landry@joomla.org>
 * @package		Joomla.Framework
 * @subpackage	Document
 * @since		1.5
 */
class NDocumentRendererBanner extends NDocumentRenderer
{
	
	function render($name = null, $params = array (), $content = null)
	{	
	require_once(ROOT_DIR."/components/com_ads/helper_banner.php");
	 $hascontext=$params['hascontext']?$params['hascontext']:0;
	$oBanner = NHelperBanner::getRandBanner($name,$hascontext);
	
	ob_start();
	if ($oBanner){
 	preg_match("/\.(.*?)$/",$oBanner->image,$matches);
	$bannerinfo=NHelperBanner::getBannerInfo($oBanner->image);
 	if ($matches[1]=='swf'):?>
	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="<?=$bannerinfo[0]?>" height="<?=$bannerinfo[1]?>">
	<param name=movie value="<?=ROOT_URL?>/components/com_ads/showbanner.php?id=<?=$oBanner->id?>&<?=rand()?>">
	<param name=quality value=high>
	<embed src="<?=ROOT_URL?>/components/com_ads/showbanner.php?id=<?=$oBanner->id?>&<?=rand()?>" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="<?=$bannerinfo[0]?>" height="<?=$bannerinfo[1]?>"></embed></object> 
<!-- START:Banner -->
	<? else:?>


<!-- START:Banner -->
	<a  href="<?=ROOT_URL?>/components/com_ads/gobanner.php?id=<?=$oBanner->id?>">
	<img <?=$bannerinfo[3]?> <?=$bannerinfo[4]?> border=0 src="<?=ROOT_URL?>/components/com_ads/showbanner.php?id=<?=$oBanner->id?>&<?=rand()?>" alt="<?=$oBanner->title?>" /></a>

<!-- END:Banner -->
	<? endif;
	} else {
	if (  $name=="728x90")
	include ROOT_DIR."/modules/ga_BIG.txt";
	}
		$content.=ob_get_contents();
		ob_end_clean();
		return $content;
	}
}